package com.heima.wemedia.controller.v1;

import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.AdWmChannelService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 频道管理
 * @author lzq
 * @data 2023/5/9 16:23
 */
@RestController
@RequestMapping("/api/v1/channel")
public class AdWmChannelController {
    @Autowired
    private AdWmChannelService adWmChannelService;
    /**
     * 频道列表展示
     * @param dto
     * @return
     */
    @PostMapping("list")
    public ResponseResult list(@RequestBody ChannelDto dto){
        return adWmChannelService.list(dto);
    }

    /**
     * 删除频道
     * @param id
     * @return
     */
    @GetMapping("/del/{id}")
    public ResponseResult del(@PathVariable Integer id){
        return adWmChannelService.del(id);
    }

    /**
     * 新增频道
     * @param wmChannel
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody WmChannel wmChannel){

        return adWmChannelService.saveChannel(wmChannel);
    }

    /**
     * 频道修改
     * @param wmChannel
     * @return
     */
    @PostMapping("update")
    public ResponseResult update(@RequestBody WmChannel wmChannel){

        return  adWmChannelService.updateChannel(wmChannel);
    }
}
